package com.twu.biblioteca.resources;

import com.twu.biblioteca.Session;
import com.twu.biblioteca.models.User;

import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * User: arvind
 * Date: 11/10/13
 * Time: 4:01 PM
 * To change this template use File | Settings | File Templates.
 */
public class UserList {

    private static UserList instance=new UserList();

    private HashMap<String,User> userList;

    private UserList(){loadUsers();}

    public static UserList getInstance()
    {
        return instance;
    }

    private void loadUsers() {

        userList=new HashMap<String, User>();

        for(int i=0;i<5;i++)
        {
            User user = new User("111-111"+(i+1),"user"+(i+1),"user"+(i+1)+"@biblioteca.com",876543210,"user1password");
            userList.put("111-111" + (i + 1), user);
        }

    }

    public String getMembershipDetails(User user) {

        return user.getUserDetails();

    }

    public User getUser(String username) {


        return userList.get(username);
    }
}
